precision mediump float;

attribute vec2 uv;
attribute vec3 position;

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

uniform float uElapsedTime;

varying float vAltitude;
varying vec2 vUv;

void main() {
  vUv = uv;

  vec4 modelPosition = modelMatrix * vec4(position, 1.0);
  modelPosition.z = -cos((modelPosition.x + uElapsedTime * 1.5) / 2.) * 2.;
  modelPosition.z += -cos((modelPosition.y + uElapsedTime * 1.5) / 2.) * 2.;

  vAltitude = modelPosition.z;

  gl_Position = projectionMatrix * viewMatrix * modelPosition;
}